Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Working With Video Fields

QuickTime 2.5 introduced three functions for working with compressed fields of video data. The ImageFieldSequenceBegin function initiates an image field sequence operation; the ImageFieldSequenceExtractCombine function performs the desired operations; and the ImageFieldSequenceEnd function terminates the operation.

ImageFieldSequenceBegin

Initiates an image field sequence operation and specifies the input and output data format.

pascal OSErr ImageFieldSequenceBegin (
                     ImageFieldSequence *ifs,
                     ImageDescriptionHandle desc1,
                     ImageDescriptionHandle desc2,
                     ImageDescriptionHandle descOut);
ifs
On return, contains the unique sequence identifier assigned to the sequence.

desc1
An image description structure describing the format and characteristics of the data to be passed to the ImageFieldSequenceExtractCombine function through the data1 parameter.

desc2
An image description structure describing the format and characteristics of the data to be passed to the ImageFieldSequenceExtractCombine function through the data2 parameter. Set to nil if the requested operation uses only one input frame.

descOut
Specifies the desired format of the resulting frames. Typically this is the same format specified by the desc1 and desc2 parameters.

DISCUSSION

You use the ImageFieldSequenceBegin function to set up an image field sequence operation and specify the input and output data format.

RESULT Codes

noErr
0 No error
paramErr
-50 Invalid parameter specified
memFullErr
-108 Not enough memory available

ImageFieldSequenceExtractCombine

Performs field operations on video data.

pascal OSErr ImageFieldSequenceExtractCombine (
                     ImageFieldSequence ifs,
                     long fieldFlags,
                     void *data1,
                     long dataSize1,
                     void *data2,
                     long dataSize2,
                     void *outputData,
                     long *outDataSize);
ifs
The unique sequence identifier that was returned by the ImageFieldSequenceBegin function.

fieldFlags
Flags specifying the operation to be performed. A correctly formed request will specify two input fields, mapping one to the odd output field and the other to the even output field. The following flags are defined:

evenField1ToEvenFieldOut
Maps the even field specified by the data1 parameter to the even output field.

evenField1ToOddFieldOut
Maps the even field specified by the data1 parameter to the odd output field.

oddField1ToEvenFieldOut
Maps the odd field specified by the data1 parameter to the even output field.

oddField1ToOddFieldOut
Maps the odd field specified by the data1 parameter to the odd output field.

evenField2ToEvenFieldOut
Maps the even field specified by the data2 parameter to the even output field.

evenField2ToOddFieldOut
Maps the even field specified by the data2 parameter to the odd output field.

oddField2ToEvenFieldOut
Maps the odd field specified by the data2 parameter to the even output field.

oddField2ToOddFieldOut
Maps the odd field specified by the data2 parameter to the odd output field.

data1
A pointer to a buffer containing the data of input field one.

dataSize1
Specifies the size of the data1 buffer.

data2
A pointer to a buffer containing the data of input field two. Set to nil if the requested operation uses only one input frame.

dataSize2
Specifies the size of the data2 buffer. Set to 0 if the requested operation uses only one input frame.

outputData
A pointer to a buffer to receive the resulting frame. Use the GetMaxCompressionSize function to determine the amount of memory to allocate for this buffer.

outDataSize
On output this parameter returns the actual size of the data.

DISCUSSION

This function was introduced in QuickTime 2.5 and provides a method for working directly with fields of interlaced video. You can use the ImageFieldSequenceExtractCombine function to change the field dominance of an image by reversing the two fields, or to create or remove the effects of the 3:2 pulldown commonly performed when transferring film to NTSC videotape.

Because this function operates directly on the compressed video data, it is faster than working with decompressed images. It also has the added benefit of eliminating any image quality degradation that might result from lossy codecs.

The ImageFieldSequenceExtractCombine function accepts one or two compressed images as input and creates a single compressed image on output. You specify the operation to be performed using the fieldFlags parameter. The function returns the codecUnimpErr result code if there is no codec present in the system that can perform the requested operation.

The Apple Component Video (YUV) and Motion JPEG codecs currently support this function. See Chapter 4, "Image Compressor Components," for information on incorporating support for this function in your codec.

RESULT Codes

noErr
0 No error
paramErr
-50 Invalid parameter specified
memFullErr
-108 Not enough memory available
codecUnimpErr
-8962 Feature not implemented by this compressor

ImageFieldSequenceEnd

Ends an image field sequence operation.

pascal OSErr ImageFieldSequenceEnd (ImageFieldSequence ifs);
ifs
The unique sequence identifier that was returned by the ImageFieldSequenceBegin function.

DISCUSSION

You must call this function to terminate an image field sequence operation.

RESULT Codes

noErr
0 No error
paramErr
-50 Invalid parameter specified

© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |